package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tech.aistar.entity.Collect;

import java.util.List;

@Repository
public interface CollectMapper {
    @Insert("Insert into collect(language_type,col_type,col_diff,col_stem,col_id,que_id) value (#{languageType},#{colType},#{colDiff},#{colStem},#{colId},#{queId})")
     Integer InsertAll(Collect collect);
    @Select("select col_stem from collect")
    List<String> findColStem();
    @Select("select col_stem from collect where col_stem = '${stem}'")
    String findstem(String stem);
    @Select("select * from collect where col_id=${uid}")
    List<Collect> findAllUserCol(String uid);

    //查询这个题目是否存在
    @Select("select * from collect where col_id = #{colId} and col_type = #{colType} and que_id = #{queId}")
    List<Collect> findQueId(@Param("colId") Long colId,@Param("colType") String colType,@Param("queId") Long queId);

    @Delete("delete from collect where col_id = #{colId} and col_type = #{colType} and que_id = #{queId};")
    Integer delCollect(@Param("colId") Long colId,@Param("colType") String colType,@Param("queId") Long queId);


}
